﻿using STHPMS1.BLL.B_Core;
using STHPMS1.ICore.I_BLL.Bus;
using STHPMS1.ICore.I_Entity.Info;
using STHPMS1.ICore.I_Entity.Stmpms1;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace STHPMS1.BLL.B_Bus
{
    public class Df_Seclass_ProjBus : BllBase, IDf_Seclass_ProjBill
    {
        public void Save<T>(T entity)
            where T : class ,IDf_Seclass_Proj
        {
            if (this.Scene.Dal.Sthpms1.Update(entity) == 0)
            {
                this.Scene.Dal.Sthpms1.Insert(entity);
            }
        }

        public void Remove(IDf_Seclass_Proj entity)
        {
            this.Scene.Dal.Sthpms1.Delete(entity);
        }

        public IEnumerable<T> Get<T>(Expression<Func<T, bool>> predicate, IPagingInfo info)
            where T : class, IDf_Seclass_Proj
        {
            return this.Scene.Dal.Sthpms1.Select<T>(predicate, info);
        }


        /// <summary>
        /// 根据条件获取长度：资金受限条件养护方案表
        /// </summary>
        /// <param name="anni_name">资金模型名称</param>
        /// <param name="analy_year">分析年度</param>
        /// <param name="rd_class">技术等级</param>
        /// <param name="segid_main">养护类型</param>
        /// <returns></returns>
        public double GetRoadLenght(string anni_name, string analy_year, int rd_class, int segid_main)
        {
            return this.Scene.Dal.Sthpms1.Df_Seclass_Proj.GetRoadLenght(anni_name, analy_year, rd_class, segid_main);
        }

        /// <summary>
        /// 根据条件获取路段养护费用：资金受限条件养护方案表
        /// </summary>
        /// <param name="anni_name">资金模型名称</param>
        /// <param name="analy_year">分析年度</param>
        /// <param name="rd_class">技术等级</param>
        /// <param name="segid_main">养护类型</param>
        /// <returns></returns>
        public double GetSegid_MainCOST(string anni_name, string analy_year, int rd_class, int segid_main)
        {
            return this.Scene.Dal.Sthpms1.Df_Seclass_Proj.GetSegid_MainCOST(anni_name,analy_year,rd_class, segid_main);
        }

        /// <summary>
        /// 获取该资金模型下的所有技术等级：资金受限条件养护方案表
        /// </summary>
        /// <param name="anni_name">资金模型名称</param>
        /// <returns></returns>
        public List<int> GetRD_ClassList(string anni_name)
        {
            return this.Scene.Dal.Sthpms1.Df_Seclass_Proj.GetRD_ClassList(anni_name);
        }

        
    }
}
